package com.bamboo.tool.store;

import com.bamboo.tool.config.model.ProjectInfo;
import com.bamboo.tool.db.entity.BambooApiMethod;
import com.bamboo.tool.entity.*;
import com.bamboo.tool.enums.RequestMethod;
import com.bamboo.tool.enums.SoaType;
import com.intellij.openapi.project.Project;

import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Create by GuoQing
 * Date 2022/7/25 14:39
 * Description
 */
public interface StoreService {
    /**
     * chush
     */
    void initTable();

    void initData();

    /**
     * 获取所有注解信息
     *
     * @return
     */
    List<AnnotationInfoSetting> getAllAnnotation();

    /**
     * 搜索api
     *
     * @param searchChar
     * @param requestMethods
     * @param projectIds
     * @return
     */
    List<BambooApiMethod> searchApi(String searchChar, Set<RequestMethod> requestMethods, Set<SoaType> soaTypes, Set<Integer> projectIds, Project project, Boolean isShowDesc);

    void saveData(ApiClass apiClass, Integer projectId);

    /**
     * 查询所有项目信息
     */
    /**
     * 获取所有的项目信息
     */
    List<ProjectInfo> getAllProjectInfos();

    /**
     * 根据条件获取查询class信息
     */
    Collection<ApiClass> getApiClass(QueryClassParameter queryClassParameter);

    List<BambooDict> getAllDictByCode(List<String> codes);

    void updateIsShowDesc(Boolean isShowDesc);

    void updateDescFrameworkSequence(List<BambooDict> dicts) throws SQLException;

    boolean selectIsShowDesc();

    /**
     * 重命名项目名称
     * @param projectId 项目id
     * @param rename 重命名文字
     */
    void renameProject(Integer projectId, String rename);

     void renameClass(String classId,String rename);
    void renameMethod(String methodId,String rename);

    /**
     * 查询当前项目持久化信息
     * @param projectId 项目id
     */
    Map<String, PersistenceInfo> getCurrentProjectAllPersistenceInfo(String projectId);

    ProjectInfo queryProject(String projectPath, String projectName);

    void deleteInvalidProject();
}
